import java.util.concurrent.TimeUnit;

public class Deamons {
	public static void main(String[] args) throws Exception{
		Thread t = new Thread(new Deamon());
		t.setDaemon(true);
		t.start();
		System.out.println("Deamon is start");
		System.out.println("t.isDeamon:" + t.isDaemon());
		
		TimeUnit.SECONDS.sleep(1);
	}
}

class DeamonSpawn implements Runnable {
	@Override
	public void run() {
		while (true) {
			Thread.yield();
		}
	}
}

class Deamon implements Runnable {
	Thread[] t = new Thread[10];

	@Override
	public void run() {
		for (int i = 0; i < t.length; i++) {
			t[i] = new Thread(new DeamonSpawn());
			t[i].start();
			System.out.println("DeamonSpawn " + i + " is start");
		}
		for (int i = 0; i < t.length; i++) {
			System.out.println("t[" + i + "].isDeamon:" + t[i].isDaemon());
		}
		while (true) {
			Thread.yield();
		}

	}
}